\hypertarget{class_q_c_p_abstract_item}{}\section{Q\+C\+P\+Abstract\+Item Class Reference}
\label{class_q_c_p_abstract_item}\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}


The abstract base class for all items in a plot.  


Inheritance diagram for Q\+C\+P\+Abstract\+Item\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=12.000000cm]{class_q_c_p_abstract_item}
\end{center}
\end{figure}
\subsection*{Signals}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{class_q_c_p_abstract_item_aa5cffb034fc65dbb91c77e02c1c14251}{selection\+Changed}} (bool selected)
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a5b266c11aac61cb511901f3911dac2a3}\label{class_q_c_p_abstract_item_a5b266c11aac61cb511901f3911dac2a3}} 
void {\bfseries selectable\+Changed} (bool selectable)
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_q_c_p_abstract_item_a9922507d8b4503a1fe1ed0b1030e23b6}{Q\+C\+P\+Abstract\+Item}} (\mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} $\ast$parent\+Plot)
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a42715ad5f3d7fca6854025fa5636f436}\label{class_q_c_p_abstract_item_a42715ad5f3d7fca6854025fa5636f436}} 
bool {\bfseries clip\+To\+Axis\+Rect} () const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_ae162314efd3fe1a6d4df11da1d275d52}\label{class_q_c_p_abstract_item_ae162314efd3fe1a6d4df11da1d275d52}} 
\mbox{\hyperlink{class_q_c_p_axis_rect}{Q\+C\+P\+Axis\+Rect}} $\ast$ {\bfseries clip\+Axis\+Rect} () const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_ae29aa489767352b40c4aaa7ea50c5582}\label{class_q_c_p_abstract_item_ae29aa489767352b40c4aaa7ea50c5582}} 
bool {\bfseries selectable} () const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_aa069fba320a13639f119f82ad29ead96}\label{class_q_c_p_abstract_item_aa069fba320a13639f119f82ad29ead96}} 
bool {\bfseries selected} () const
\item 
void \mbox{\hyperlink{class_q_c_p_abstract_item_a39e05b9d4176b9accafc746d16ca6a06}{set\+Clip\+To\+Axis\+Rect}} (bool clip)
\item 
void \mbox{\hyperlink{class_q_c_p_abstract_item_a7dc75fcbcd10206fe0b75d757ea7a347}{set\+Clip\+Axis\+Rect}} (\mbox{\hyperlink{class_q_c_p_axis_rect}{Q\+C\+P\+Axis\+Rect}} $\ast$rect)
\item 
Q\+\_\+\+S\+L\+OT void \mbox{\hyperlink{class_q_c_p_abstract_item_a8a8e32a55bc478b849756a78c2d87fd2}{set\+Selectable}} (bool selectable)
\item 
Q\+\_\+\+S\+L\+OT void \mbox{\hyperlink{class_q_c_p_abstract_item_a203de94ad586cc44d16c9565f49d3378}{set\+Selected}} (bool selected)
\item 
virtual double \mbox{\hyperlink{class_q_c_p_abstract_item_a96d522d10ffc0413b9a366c6f7f0476b}{select\+Test}} (const Q\+PointF \&pos, bool only\+Selectable, Q\+Variant $\ast$details=0) const =0
\item 
Q\+List$<$ \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} $\ast$ $>$ \mbox{\hyperlink{class_q_c_p_abstract_item_a709f655ac3f7f22d452714134662b454}{positions}} () const
\item 
Q\+List$<$ \mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}} $\ast$ $>$ \mbox{\hyperlink{class_q_c_p_abstract_item_a81d1ecfea3368b836cf9675a0045e659}{anchors}} () const
\item 
\mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} $\ast$ \mbox{\hyperlink{class_q_c_p_abstract_item_a2589c3d298f9a576d77d9addb440a18d}{position}} (const Q\+String \&name) const
\item 
\mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}} $\ast$ \mbox{\hyperlink{class_q_c_p_abstract_item_a139c255ea8831642fac91748e29a5adb}{anchor}} (const Q\+String \&name) const
\item 
bool \mbox{\hyperlink{class_q_c_p_abstract_item_a84914f4516f9b38ef0bd89eafe3dbda7}{has\+Anchor}} (const Q\+String \&name) const
\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a59279d8123663b3b2fffbe54ca075244}\label{class_q_c_p_abstract_item_a59279d8123663b3b2fffbe54ca075244}} 
virtual \mbox{\hyperlink{namespace_q_c_p_a2ad6bb6281c7c2d593d4277b44c2b037}{Q\+C\+P\+::\+Interaction}} {\bfseries selection\+Category} () const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a550ecff39195d9ff3d5cf239eb802ea7}\label{class_q_c_p_abstract_item_a550ecff39195d9ff3d5cf239eb802ea7}} 
virtual Q\+Rect {\bfseries clip\+Rect} () const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a82a408b38a93be750b934fe847a018cb}\label{class_q_c_p_abstract_item_a82a408b38a93be750b934fe847a018cb}} 
virtual void {\bfseries apply\+Default\+Antialiasing\+Hint} (\mbox{\hyperlink{class_q_c_p_painter}{Q\+C\+P\+Painter}} $\ast$painter) const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_ad0dc056f650c3ca73414e6b4f01674ef}\label{class_q_c_p_abstract_item_ad0dc056f650c3ca73414e6b4f01674ef}} 
virtual void {\bfseries draw} (\mbox{\hyperlink{class_q_c_p_painter}{Q\+C\+P\+Painter}} $\ast$painter)=0
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_aaf92af7b9893712959a6c073d334d88d}\label{class_q_c_p_abstract_item_aaf92af7b9893712959a6c073d334d88d}} 
virtual void {\bfseries select\+Event} (Q\+Mouse\+Event $\ast$event, bool additive, const Q\+Variant \&details, bool $\ast$selection\+State\+Changed)
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a91f090d6763cfedb0749219c63788ae9}\label{class_q_c_p_abstract_item_a91f090d6763cfedb0749219c63788ae9}} 
virtual void {\bfseries deselect\+Event} (bool $\ast$selection\+State\+Changed)
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a5681c190803e899bac9a240753fdba00}\label{class_q_c_p_abstract_item_a5681c190803e899bac9a240753fdba00}} 
virtual Q\+PointF {\bfseries anchor\+Pixel\+Point} (int anchor\+Id) const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a8f4d23e883cbb55219959ed6ce8f10ac}\label{class_q_c_p_abstract_item_a8f4d23e883cbb55219959ed6ce8f10ac}} 
double {\bfseries dist\+Sqr\+To\+Line} (const Q\+PointF \&start, const Q\+PointF \&end, const Q\+PointF \&point) const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a26aa3828d398e29116afee16216d6b36}\label{class_q_c_p_abstract_item_a26aa3828d398e29116afee16216d6b36}} 
double {\bfseries rect\+Select\+Test} (const Q\+RectF \&rect, const Q\+PointF \&pos, bool filled\+Rect) const
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a75036d39c4d4e2e1a7dd145fff915d32}\label{class_q_c_p_abstract_item_a75036d39c4d4e2e1a7dd145fff915d32}} 
\mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} $\ast$ {\bfseries create\+Position} (const Q\+String \&name)
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_af3fc92527802078ca395138748b629a7}\label{class_q_c_p_abstract_item_af3fc92527802078ca395138748b629a7}} 
\mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}} $\ast$ {\bfseries create\+Anchor} (const Q\+String \&name, int anchor\+Id)
\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_ad2a70ff6b658fcb84a9427f69d3f587d}\label{class_q_c_p_abstract_item_ad2a70ff6b658fcb84a9427f69d3f587d}} 
bool {\bfseries m\+Clip\+To\+Axis\+Rect}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a3e57cfe7da4b1ac3d6fa7281ea437361}\label{class_q_c_p_abstract_item_a3e57cfe7da4b1ac3d6fa7281ea437361}} 
Q\+Pointer$<$ \mbox{\hyperlink{class_q_c_p_axis_rect}{Q\+C\+P\+Axis\+Rect}} $>$ {\bfseries m\+Clip\+Axis\+Rect}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_af94ff71b6a15ea6d028ab8bd8eccd012}\label{class_q_c_p_abstract_item_af94ff71b6a15ea6d028ab8bd8eccd012}} 
Q\+List$<$ \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} $\ast$ $>$ {\bfseries m\+Positions}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a909a3abab783de302ebf0a0e6f2bbc15}\label{class_q_c_p_abstract_item_a909a3abab783de302ebf0a0e6f2bbc15}} 
Q\+List$<$ \mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}} $\ast$ $>$ {\bfseries m\+Anchors}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_ad81eb35c8726a0f458db9df9732e0e41}\label{class_q_c_p_abstract_item_ad81eb35c8726a0f458db9df9732e0e41}} 
bool {\bfseries m\+Selectable}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a4bdb3457dad1d268c0f78a44152b9645}\label{class_q_c_p_abstract_item_a4bdb3457dad1d268c0f78a44152b9645}} 
bool {\bfseries m\+Selected}
\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a1cdf9df76adcfae45261690aa0ca2198}\label{class_q_c_p_abstract_item_a1cdf9df76adcfae45261690aa0ca2198}} 
class {\bfseries Q\+Custom\+Plot}
\item 
\mbox{\Hypertarget{class_q_c_p_abstract_item_a61767d414fd57af9eb1741b34268c7fc}\label{class_q_c_p_abstract_item_a61767d414fd57af9eb1741b34268c7fc}} 
class {\bfseries Q\+C\+P\+Item\+Anchor}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
The abstract base class for all items in a plot. 

In \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}}, items are supplemental graphical elements that are neither plottables (\mbox{\hyperlink{class_q_c_p_abstract_plottable}{Q\+C\+P\+Abstract\+Plottable}}) nor axes (\mbox{\hyperlink{class_q_c_p_axis}{Q\+C\+P\+Axis}}). While plottables are always tied to two axes and thus plot coordinates, items can also be placed in absolute coordinates independent of any axes. Each specific item has at least one \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} member which controls the positioning. Some items are defined by more than one coordinate and thus have two or more \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} members (For example, \mbox{\hyperlink{class_q_c_p_item_rect}{Q\+C\+P\+Item\+Rect}} has {\itshape top\+Left} and {\itshape bottom\+Right}).

This abstract base class defines a very basic interface like visibility and clipping. Since this class is abstract, it can\textquotesingle{}t be instantiated. Use one of the subclasses or create a subclass yourself to create new items.

The built-\/in items are\+: \tabulinesep=1mm
\begin{longtabu} spread 0pt [c]{*{2}{|X[-1]}|}
\hline
\mbox{\hyperlink{class_q_c_p_item_line}{Q\+C\+P\+Item\+Line}}&A line defined by a start and an end point. May have different ending styles on each side (e.\+g. arrows). \\\cline{1-2}
\mbox{\hyperlink{class_q_c_p_item_straight_line}{Q\+C\+P\+Item\+Straight\+Line}}&A straight line defined by a start and a direction point. Unlike \mbox{\hyperlink{class_q_c_p_item_line}{Q\+C\+P\+Item\+Line}}, the straight line is infinitely long and has no endings. \\\cline{1-2}
\mbox{\hyperlink{class_q_c_p_item_curve}{Q\+C\+P\+Item\+Curve}}&A curve defined by start, end and two intermediate control points. May have different ending styles on each side (e.\+g. arrows). \\\cline{1-2}
\mbox{\hyperlink{class_q_c_p_item_rect}{Q\+C\+P\+Item\+Rect}}&A rectangle \\\cline{1-2}
\mbox{\hyperlink{class_q_c_p_item_ellipse}{Q\+C\+P\+Item\+Ellipse}}&An ellipse \\\cline{1-2}
\mbox{\hyperlink{class_q_c_p_item_pixmap}{Q\+C\+P\+Item\+Pixmap}}&An arbitrary pixmap \\\cline{1-2}
\mbox{\hyperlink{class_q_c_p_item_text}{Q\+C\+P\+Item\+Text}}&A text label \\\cline{1-2}
\mbox{\hyperlink{class_q_c_p_item_bracket}{Q\+C\+P\+Item\+Bracket}}&A bracket which may be used to reference/highlight certain parts in the plot. \\\cline{1-2}
\mbox{\hyperlink{class_q_c_p_item_tracer}{Q\+C\+P\+Item\+Tracer}}&An item that can be attached to a \mbox{\hyperlink{class_q_c_p_graph}{Q\+C\+P\+Graph}} and sticks to its data points, given a key coordinate. \\\cline{1-2}
\end{longtabu}
\hypertarget{class_q_c_p_abstract_item_items-clipping}{}\subsection{Clipping}\label{class_q_c_p_abstract_item_items-clipping}
Items are by default clipped to the main axis rect (they are only visible inside the axis rect). To make an item visible outside that axis rect, disable clipping via \mbox{\hyperlink{class_q_c_p_abstract_item_a39e05b9d4176b9accafc746d16ca6a06}{set\+Clip\+To\+Axis\+Rect(false)}}.

On the other hand if you want the item to be clipped to a different axis rect, specify it via \mbox{\hyperlink{class_q_c_p_abstract_item_a7dc75fcbcd10206fe0b75d757ea7a347}{set\+Clip\+Axis\+Rect}}. This clip\+Axis\+Rect property of an item is only used for clipping behaviour, and in principle is independent of the coordinate axes the item might be tied to via its position members (\mbox{\hyperlink{class_q_c_p_item_position_a2185f45c75ac8cb9be89daeaaad50e37}{Q\+C\+P\+Item\+Position\+::set\+Axes}}). However, it is common that the axis rect for clipping also contains the axes used for the item positions.\hypertarget{class_q_c_p_abstract_item_items-using}{}\subsection{Using items}\label{class_q_c_p_abstract_item_items-using}
First you instantiate the item you want to use and add it to the plot\+: 
\begin{DoxyCodeInclude}
\end{DoxyCodeInclude}
by default, the positions of the item are bound to the x-\/ and y-\/\+Axis of the plot. So we can just set the plot coordinates where the line should start/end\+: 
\begin{DoxyCodeInclude}
\end{DoxyCodeInclude}
If we don\textquotesingle{}t want the line to be positioned in plot coordinates but a different coordinate system, e.\+g. absolute pixel positions on the \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} surface, we need to change the position type like this\+: 
\begin{DoxyCodeInclude}
\end{DoxyCodeInclude}
Then we can set the coordinates, this time in pixels\+: 
\begin{DoxyCodeInclude}
\end{DoxyCodeInclude}
and make the line visible on the entire \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}}, by disabling clipping to the axis rect\+: 
\begin{DoxyCodeInclude}
\end{DoxyCodeInclude}
 For more advanced plots, it is even possible to set different types and parent anchors per X/Y coordinate of an item position, using for example \mbox{\hyperlink{class_q_c_p_item_position_a2113b2351d6d00457fb3559a4e20c3ea}{Q\+C\+P\+Item\+Position\+::set\+TypeX}} or \mbox{\hyperlink{class_q_c_p_item_position_add71461a973927c74e42179480916d9c}{Q\+C\+P\+Item\+Position\+::set\+Parent\+AnchorX}}. For details, see the documentation of \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}}.\hypertarget{class_q_c_p_abstract_item_items-subclassing}{}\subsection{Creating own items}\label{class_q_c_p_abstract_item_items-subclassing}
To create an own item, you implement a subclass of \mbox{\hyperlink{class_q_c_p_abstract_item}{Q\+C\+P\+Abstract\+Item}}. These are the pure virtual functions, you must implement\+: \begin{DoxyItemize}
\item \mbox{\hyperlink{class_q_c_p_abstract_item_a96d522d10ffc0413b9a366c6f7f0476b}{select\+Test}} \item draw\end{DoxyItemize}
See the documentation of those functions for what they need to do.\hypertarget{class_q_c_p_abstract_item_items-positioning}{}\subsubsection{Allowing the item to be positioned}\label{class_q_c_p_abstract_item_items-positioning}
As mentioned, item positions are represented by \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} members. Let\textquotesingle{}s assume the new item shall have only one point as its position (as opposed to two like a rect or multiple like a polygon). You then add a public member of type \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} like so\+:


\begin{DoxyCode}
\mbox{\hyperlink{class_q_c_p_item_position}{QCPItemPosition}} * \textcolor{keyword}{const} myPosition;
\end{DoxyCode}


the const makes sure the pointer itself can\textquotesingle{}t be modified from the user of your new item (the \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} instance it points to, can be modified, of course). The initialization of this pointer is made easy with the create\+Position function. Just assign the return value of this function to each \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} in the constructor of your item. create\+Position takes a string which is the name of the position, typically this is identical to the variable name. For example, the constructor of Q\+C\+P\+Item\+Example could look like this\+:


\begin{DoxyCode}
QCPItemExample::QCPItemExample(\mbox{\hyperlink{class_q_custom_plot}{QCustomPlot}} *parentPlot) :
  \mbox{\hyperlink{class_q_c_p_abstract_item}{QCPAbstractItem}}(parentPlot),
  myPosition(createPosition(\textcolor{stringliteral}{"myPosition"}))
\{
  \textcolor{comment}{// other constructor code}
\}
\end{DoxyCode}
\hypertarget{class_q_c_p_abstract_item_items-drawing}{}\subsubsection{The draw function}\label{class_q_c_p_abstract_item_items-drawing}
To give your item a visual representation, reimplement the draw function and use the passed \mbox{\hyperlink{class_q_c_p_painter}{Q\+C\+P\+Painter}} to draw the item. You can retrieve the item position in pixel coordinates from the position member(s) via \mbox{\hyperlink{class_q_c_p_item_position_a6cad070c22801295231f5bd6045afe70}{Q\+C\+P\+Item\+Position\+::pixel\+Point}}.

To optimize performance you should calculate a bounding rect first (don\textquotesingle{}t forget to take the pen width into account), check whether it intersects the clip\+Rect, and only draw the item at all if this is the case.\hypertarget{class_q_c_p_abstract_item_items-selection}{}\subsubsection{The select\+Test function}\label{class_q_c_p_abstract_item_items-selection}
Your implementation of the \mbox{\hyperlink{class_q_c_p_abstract_item_a96d522d10ffc0413b9a366c6f7f0476b}{select\+Test}} function may use the helpers dist\+Sqr\+To\+Line and rect\+Select\+Test. With these, the implementation of the selection test becomes significantly simpler for most items. See the documentation of \mbox{\hyperlink{class_q_c_p_abstract_item_a96d522d10ffc0413b9a366c6f7f0476b}{select\+Test}} for what the function parameters mean and what the function should return.\hypertarget{class_q_c_p_abstract_item_anchors}{}\subsubsection{Providing anchors}\label{class_q_c_p_abstract_item_anchors}
Providing anchors (\mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}}) starts off like adding a position. First you create a public member, e.\+g.


\begin{DoxyCode}
\mbox{\hyperlink{class_q_c_p_item_anchor}{QCPItemAnchor}} * \textcolor{keyword}{const} bottom;
\end{DoxyCode}


and create it in the constructor with the create\+Anchor function, assigning it a name and an anchor id (an integer enumerating all anchors on the item, you may create an own enum for this). Since anchors can be placed anywhere, relative to the item\textquotesingle{}s position(s), your item needs to provide the position of every anchor with the reimplementation of the anchor\+Pixel\+Point(int anchor\+Id) function.

In essence the \mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}} is merely an intermediary that itself asks your item for the pixel position when anything attached to the anchor needs to know the coordinates. 

\subsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a9922507d8b4503a1fe1ed0b1030e23b6}\label{class_q_c_p_abstract_item_a9922507d8b4503a1fe1ed0b1030e23b6}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{Q\+C\+P\+Abstract\+Item()}{QCPAbstractItem()}}
{\footnotesize\ttfamily Q\+C\+P\+Abstract\+Item\+::\+Q\+C\+P\+Abstract\+Item (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} $\ast$}]{parent\+Plot }\end{DoxyParamCaption})}

Base class constructor which initializes base class members. 

\subsection{Member Function Documentation}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a139c255ea8831642fac91748e29a5adb}\label{class_q_c_p_abstract_item_a139c255ea8831642fac91748e29a5adb}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!anchor@{anchor}}
\index{anchor@{anchor}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{anchor()}{anchor()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}} $\ast$ Q\+C\+P\+Abstract\+Item\+::anchor (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{name }\end{DoxyParamCaption}) const}

Returns the \mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}} with the specified {\itshape name}. If this item doesn\textquotesingle{}t have an anchor by that name, returns 0.

This function provides an alternative way to access item anchors. Normally, you access anchors direcly by their member pointers (which typically have the same variable name as {\itshape name}).

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_c_p_abstract_item_a81d1ecfea3368b836cf9675a0045e659}{anchors}}, \mbox{\hyperlink{class_q_c_p_abstract_item_a2589c3d298f9a576d77d9addb440a18d}{position}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a81d1ecfea3368b836cf9675a0045e659}\label{class_q_c_p_abstract_item_a81d1ecfea3368b836cf9675a0045e659}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!anchors@{anchors}}
\index{anchors@{anchors}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{anchors()}{anchors()}}
{\footnotesize\ttfamily Q\+List$<$ \mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}} $\ast$ $>$ Q\+C\+P\+Abstract\+Item\+::anchors (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

Returns all anchors of the item in a list. Note that since a position (\mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}}) is always also an anchor, the list will also contain the positions of this item.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_c_p_abstract_item_a709f655ac3f7f22d452714134662b454}{positions}}, \mbox{\hyperlink{class_q_c_p_abstract_item_a139c255ea8831642fac91748e29a5adb}{anchor}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a84914f4516f9b38ef0bd89eafe3dbda7}\label{class_q_c_p_abstract_item_a84914f4516f9b38ef0bd89eafe3dbda7}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!has\+Anchor@{has\+Anchor}}
\index{has\+Anchor@{has\+Anchor}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{has\+Anchor()}{hasAnchor()}}
{\footnotesize\ttfamily bool Q\+C\+P\+Abstract\+Item\+::has\+Anchor (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{name }\end{DoxyParamCaption}) const}

Returns whether this item has an anchor with the specified {\itshape name}.

Note that you can check for positions with this function, too. This is because every position is also an anchor (\mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} inherits from \mbox{\hyperlink{class_q_c_p_item_anchor}{Q\+C\+P\+Item\+Anchor}}).

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_c_p_abstract_item_a139c255ea8831642fac91748e29a5adb}{anchor}}, \mbox{\hyperlink{class_q_c_p_abstract_item_a2589c3d298f9a576d77d9addb440a18d}{position}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a2589c3d298f9a576d77d9addb440a18d}\label{class_q_c_p_abstract_item_a2589c3d298f9a576d77d9addb440a18d}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!position@{position}}
\index{position@{position}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{position()}{position()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} $\ast$ Q\+C\+P\+Abstract\+Item\+::position (\begin{DoxyParamCaption}\item[{const Q\+String \&}]{name }\end{DoxyParamCaption}) const}

Returns the \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} with the specified {\itshape name}. If this item doesn\textquotesingle{}t have a position by that name, returns 0.

This function provides an alternative way to access item positions. Normally, you access positions direcly by their member pointers (which typically have the same variable name as {\itshape name}).

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_c_p_abstract_item_a709f655ac3f7f22d452714134662b454}{positions}}, \mbox{\hyperlink{class_q_c_p_abstract_item_a139c255ea8831642fac91748e29a5adb}{anchor}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a709f655ac3f7f22d452714134662b454}\label{class_q_c_p_abstract_item_a709f655ac3f7f22d452714134662b454}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!positions@{positions}}
\index{positions@{positions}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{positions()}{positions()}}
{\footnotesize\ttfamily Q\+List$<$ \mbox{\hyperlink{class_q_c_p_item_position}{Q\+C\+P\+Item\+Position}} $\ast$ $>$ Q\+C\+P\+Abstract\+Item\+::positions (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

Returns all positions of the item in a list.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_c_p_abstract_item_a81d1ecfea3368b836cf9675a0045e659}{anchors}}, \mbox{\hyperlink{class_q_c_p_abstract_item_a2589c3d298f9a576d77d9addb440a18d}{position}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_q_c_p_abstract_item_aa5cffb034fc65dbb91c77e02c1c14251}\label{class_q_c_p_abstract_item_aa5cffb034fc65dbb91c77e02c1c14251}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!selection\+Changed@{selection\+Changed}}
\index{selection\+Changed@{selection\+Changed}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{selection\+Changed}{selectionChanged}}
{\footnotesize\ttfamily void Q\+C\+P\+Abstract\+Item\+::selection\+Changed (\begin{DoxyParamCaption}\item[{bool}]{selected }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [signal]}}

This signal is emitted when the selection state of this item has changed, either by user interaction or by a direct call to \mbox{\hyperlink{class_q_c_p_abstract_item_a203de94ad586cc44d16c9565f49d3378}{set\+Selected}}. \mbox{\Hypertarget{class_q_c_p_abstract_item_a96d522d10ffc0413b9a366c6f7f0476b}\label{class_q_c_p_abstract_item_a96d522d10ffc0413b9a366c6f7f0476b}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!select\+Test@{select\+Test}}
\index{select\+Test@{select\+Test}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{select\+Test()}{selectTest()}}
{\footnotesize\ttfamily virtual double Q\+C\+P\+Abstract\+Item\+::select\+Test (\begin{DoxyParamCaption}\item[{const Q\+PointF \&}]{pos,  }\item[{bool}]{only\+Selectable,  }\item[{Q\+Variant $\ast$}]{details = {\ttfamily 0} }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [pure virtual]}}

This function is used to decide whether a click hits a layerable object or not.

{\itshape pos} is a point in pixel coordinates on the \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn\textquotesingle{}t be determined, -\/1.\+0 is returned. Further, if {\itshape only\+Selectable} is true and the object is not selectable, -\/1.\+0 is returned, too.

If the object is represented not by single lines but by an area like a \mbox{\hyperlink{class_q_c_p_item_text}{Q\+C\+P\+Item\+Text}} or the bars of a \mbox{\hyperlink{class_q_c_p_bars}{Q\+C\+P\+Bars}} plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot\textquotesingle{}s selection tolerance. (typically the selection\+Tolerance multiplied by 0.\+99).

Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.\+e. closer than 0.\+99$\ast$selection\+Tolerance).

The actual setting of the selection state is not done by this function. This is handled by the parent \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} when the mouse\+Release\+Event occurs, and the finally selected object is notified via the select\+Event/deselect\+Event methods.

{\itshape details} is an optional output parameter. Every layerable subclass may place any information in {\itshape details}. This information will be passed to select\+Event when the parent \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} decides on the basis of this select\+Test call, that the object was successfully selected. The subsequent call to select\+Event will carry the {\itshape details}. This is useful for multi-\/part objects (like \mbox{\hyperlink{class_q_c_p_axis}{Q\+C\+P\+Axis}}). This way, a possibly complex calculation to decide which part was clicked is only done once in \mbox{\hyperlink{class_q_c_p_abstract_item_a96d522d10ffc0413b9a366c6f7f0476b}{select\+Test}}. The result (i.\+e. the actually clicked part) can then be placed in {\itshape details}. So in the subsequent select\+Event, the decision which part was selected doesn\textquotesingle{}t have to be done a second time for a single selection operation.

You may pass 0 as {\itshape details} to indicate that you are not interested in those selection details.

\begin{DoxySeeAlso}{See also}
select\+Event, deselect\+Event, \mbox{\hyperlink{class_q_custom_plot_a5ee1e2f6ae27419deca53e75907c27e5}{Q\+Custom\+Plot\+::set\+Interactions}} 
\end{DoxySeeAlso}


Reimplemented from \mbox{\hyperlink{class_q_c_p_layerable_a04db8351fefd44cfdb77958e75c6288e}{Q\+C\+P\+Layerable}}.



Implemented in \mbox{\hyperlink{class_q_c_p_item_bracket_a971299aa6fef75730d6f10efdaf48616}{Q\+C\+P\+Item\+Bracket}}, \mbox{\hyperlink{class_q_c_p_item_tracer_ae1dc728384936184e7552a6d0d67fd75}{Q\+C\+P\+Item\+Tracer}}, \mbox{\hyperlink{class_q_c_p_item_pixmap_a7583a98ebd3f35d2ac5d6c05fad25a6c}{Q\+C\+P\+Item\+Pixmap}}, \mbox{\hyperlink{class_q_c_p_item_ellipse_aa41be2180b2ace2e303b88d005c14243}{Q\+C\+P\+Item\+Ellipse}}, \mbox{\hyperlink{class_q_c_p_item_text_aca74494fd5e769f331a6eb3e29f32916}{Q\+C\+P\+Item\+Text}}, \mbox{\hyperlink{class_q_c_p_item_rect_abe1a6091591d3bad5e4efab2331f99ec}{Q\+C\+P\+Item\+Rect}}, \mbox{\hyperlink{class_q_c_p_item_curve_a8018b8b3fc552a44ba87ca4b64c1523f}{Q\+C\+P\+Item\+Curve}}, \mbox{\hyperlink{class_q_c_p_item_line_ae6cc5183f568e5fa9d7827abe4d405b5}{Q\+C\+P\+Item\+Line}}, and \mbox{\hyperlink{class_q_c_p_item_straight_line_a1e5d99d79efb5871600c72bcd2891a0f}{Q\+C\+P\+Item\+Straight\+Line}}.

\mbox{\Hypertarget{class_q_c_p_abstract_item_a7dc75fcbcd10206fe0b75d757ea7a347}\label{class_q_c_p_abstract_item_a7dc75fcbcd10206fe0b75d757ea7a347}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!set\+Clip\+Axis\+Rect@{set\+Clip\+Axis\+Rect}}
\index{set\+Clip\+Axis\+Rect@{set\+Clip\+Axis\+Rect}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{set\+Clip\+Axis\+Rect()}{setClipAxisRect()}}
{\footnotesize\ttfamily void Q\+C\+P\+Abstract\+Item\+::set\+Clip\+Axis\+Rect (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_q_c_p_axis_rect}{Q\+C\+P\+Axis\+Rect}} $\ast$}]{rect }\end{DoxyParamCaption})}

Sets the clip axis rect. It defines the rect that will be used to clip the item when \mbox{\hyperlink{class_q_c_p_abstract_item_a39e05b9d4176b9accafc746d16ca6a06}{set\+Clip\+To\+Axis\+Rect}} is set to true.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_c_p_abstract_item_a39e05b9d4176b9accafc746d16ca6a06}{set\+Clip\+To\+Axis\+Rect}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a39e05b9d4176b9accafc746d16ca6a06}\label{class_q_c_p_abstract_item_a39e05b9d4176b9accafc746d16ca6a06}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!set\+Clip\+To\+Axis\+Rect@{set\+Clip\+To\+Axis\+Rect}}
\index{set\+Clip\+To\+Axis\+Rect@{set\+Clip\+To\+Axis\+Rect}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{set\+Clip\+To\+Axis\+Rect()}{setClipToAxisRect()}}
{\footnotesize\ttfamily void Q\+C\+P\+Abstract\+Item\+::set\+Clip\+To\+Axis\+Rect (\begin{DoxyParamCaption}\item[{bool}]{clip }\end{DoxyParamCaption})}

Sets whether the item shall be clipped to an axis rect or whether it shall be visible on the entire \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}}. The axis rect can be set with \mbox{\hyperlink{class_q_c_p_abstract_item_a7dc75fcbcd10206fe0b75d757ea7a347}{set\+Clip\+Axis\+Rect}}.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_c_p_abstract_item_a7dc75fcbcd10206fe0b75d757ea7a347}{set\+Clip\+Axis\+Rect}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a8a8e32a55bc478b849756a78c2d87fd2}\label{class_q_c_p_abstract_item_a8a8e32a55bc478b849756a78c2d87fd2}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!set\+Selectable@{set\+Selectable}}
\index{set\+Selectable@{set\+Selectable}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{set\+Selectable()}{setSelectable()}}
{\footnotesize\ttfamily void Q\+C\+P\+Abstract\+Item\+::set\+Selectable (\begin{DoxyParamCaption}\item[{bool}]{selectable }\end{DoxyParamCaption})}

Sets whether the user can (de-\/)select this item by clicking on the \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} surface. (When \mbox{\hyperlink{class_q_custom_plot_a5ee1e2f6ae27419deca53e75907c27e5}{Q\+Custom\+Plot\+::set\+Interactions}} contains Q\+Custom\+Plot\+::i\+Select\+Items.)

However, even when {\itshape selectable} was set to false, it is possible to set the selection manually, by calling \mbox{\hyperlink{class_q_c_p_abstract_item_a203de94ad586cc44d16c9565f49d3378}{set\+Selected}}.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_custom_plot_a5ee1e2f6ae27419deca53e75907c27e5}{Q\+Custom\+Plot\+::set\+Interactions}}, \mbox{\hyperlink{class_q_c_p_abstract_item_a203de94ad586cc44d16c9565f49d3378}{set\+Selected}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_q_c_p_abstract_item_a203de94ad586cc44d16c9565f49d3378}\label{class_q_c_p_abstract_item_a203de94ad586cc44d16c9565f49d3378}} 
\index{Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}!set\+Selected@{set\+Selected}}
\index{set\+Selected@{set\+Selected}!Q\+C\+P\+Abstract\+Item@{Q\+C\+P\+Abstract\+Item}}
\subsubsection{\texorpdfstring{set\+Selected()}{setSelected()}}
{\footnotesize\ttfamily void Q\+C\+P\+Abstract\+Item\+::set\+Selected (\begin{DoxyParamCaption}\item[{bool}]{selected }\end{DoxyParamCaption})}

Sets whether this item is selected or not. When selected, it might use a different visual appearance (e.\+g. pen and brush), this depends on the specific item though.

The entire selection mechanism for items is handled automatically when \mbox{\hyperlink{class_q_custom_plot_a5ee1e2f6ae27419deca53e75907c27e5}{Q\+Custom\+Plot\+::set\+Interactions}} contains Q\+Custom\+Plot\+::i\+Select\+Items. You only need to call this function when you wish to change the selection state manually.

This function can change the selection state even when \mbox{\hyperlink{class_q_c_p_abstract_item_a8a8e32a55bc478b849756a78c2d87fd2}{set\+Selectable}} was set to false.

emits the \mbox{\hyperlink{class_q_c_p_abstract_item_aa5cffb034fc65dbb91c77e02c1c14251}{selection\+Changed}} signal when {\itshape selected} is different from the previous selection state.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_q_c_p_abstract_item_a8a8e32a55bc478b849756a78c2d87fd2}{set\+Selectable}}, \mbox{\hyperlink{class_q_c_p_abstract_item_a96d522d10ffc0413b9a366c6f7f0476b}{select\+Test}} 
\end{DoxySeeAlso}


The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
R\+:/\+Develop/a0-\/develop/\+Lib\+Q\+Qt/src/charts/qcustomplot/\mbox{\hyperlink{qcustomplot_8h}{qcustomplot.\+h}}\item 
R\+:/\+Develop/a0-\/develop/\+Lib\+Q\+Qt/src/charts/qcustomplot/\mbox{\hyperlink{qcustomplot_8cpp}{qcustomplot.\+cpp}}\end{DoxyCompactItemize}
